<?php
require_once 'Database.php';
require_once 'MonHoc.php';

class MonHocDAO {
  public static function findAll() {
    $db = Database::getInstance();
    $stmt = $db->prepare("SELECT * FROM monhoc");
    $stmt->execute();
    $rows = $stmt->fetchAll();

    foreach ($rows AS $row) {
      $mh = new MonHoc();
      $mh -> setID($row['id']);
      $mh -> setMHName($row['tenmh']);
      $result[] = $mh;
    }
    return $result;
  }
}

?>
